<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>投票标题管理</title>
<link rel="stylesheet" type="text/css" th:href="@{/mystatic/bootstrap-3.4.1-dist/css/bootstrap.css}" />
<link rel="stylesheet" type="text/css" th:href="@{/mystatic/bootstrap-3.4.1-dist/css/bootstrap-theme.css}" />
<script type="text/javascript">
  function deleteSubject(vsid){
     //alert(typeof(vsid));
	  var boo = window.confirm("确定删除吗?删除后数据无法恢复!!!");
	  if(boo == true){
		  window.location.href="deleteSubjectByid?vsid="+vsid;
	  }
  }
 </script>
</head>
<body>
<h3 align="center" >标题管理</h3>
<h4 align="center" > <a th:href="@{/adminsubinfo}"  > 发布新投票 </a></h4>
<hr/>
<div class="container-fluid" >
  <div class="row">
    <div class="col-md-2"></div>
    <div class="col-md-8">
       <table class="table table-hover" border="0" align="center" width="500px" >
    <tr>
      <td>序号</td><td>标题</td><td>选项数</td><td>投票人数</td><td>操作</td>
    </tr>
    <tr th:each="v:${pinfo.list}">
        <td th:text="${v.vssid}"></td>
        <td th:text="${v.vs_title}"></td>
        <td th:text="${v.subcount}"></td>
        <td th:text="${v.vicount}"></td>
        <td><a href="javascript:void(0)" th:onclick="'deleteSubject(\''+${v.vssid}+'\')'"  class="btn btn-danger btn-xs">删除1</a>
            <a href="javascript:void(0)" th:onclick="'deleteSubject('+${v.vssid}+')'"  class="btn btn-danger btn-xs">删除2</a>
            <a href="javascript:void(0)" th:onclick="deleteSubject('[[${v.vssid}]]')"  class="btn btn-danger btn-xs">删除3</a>
            <a th:href="@{/selectSubjectAndOptionInfo?(vsid=${v.vssid})}"  class="btn btn-primary btn-xs">编辑</a>
        </td>
    </tr>
   </table>
    <table border="0" align="center" width="500px" >
    <tr>
        <td>
           <span th:if="${pinfo.pages ge 1 } ">
                <a th:if="${ pinfo.pageNum gt 1}" th:href="@{/adminselectsubjectDetail?(index=1,size=${pinfo.pageSize})}"  >首页</a>
                <a th:if="${ pinfo.pageNum gt 1}" th:href="@{/adminselectsubjectDetail?(index=${pinfo.pageNum - 1},size=${pinfo.pageSize})}">上一页</a>
                <span th:each="v:${#numbers.sequence(pinfo.pageNum > 2 ? pinfo.pageNum-2 : 1,(pinfo.pages - pinfo.pageNum) >2 ? (pinfo.pageNum+2): pinfo.pages)}">
                    <a th:href="@{/adminselectsubjectDetail?(index=${v},size=${pinfo.pageSize})}"
                       th:style="${pinfo.pageNum eq v } ? 'color:red;font-size:20px' : '' " th:text="${v}" > </a>
                </span>
                <a th:if="${pinfo.pageNum lt pinfo.pages}" th:href="@{/adminselectsubjectDetail?(index=${pinfo.pageNum + 1},size=${pinfo.pageSize})}">下一页</a>
                <a th:if="${pinfo.pageNum lt pinfo.pages}" th:href="@{/adminselectsubjectDetail?(index=${pinfo.pages},size=${pinfo.pageSize})}" >尾页</a>
           </span>
       </td>
    </tr>
    </table>
    </div>
    <div class="col-md-2"></div>
  </div>
</div>
    <script th:if="${session.delsuberr != null}" type="text/javascript">
       alert("该标题已经被投过票,不能被删除");
       [(${#session.removeAttribute('delsuberr')})]
   </script>
    <script th:if="${session.delsubok != null}" type="text/javascript">
        alert("删除成功");
        [(${#session.removeAttribute('delsubok')})]
    </script>
    <script th:if="${session.editok != null}" type="text/javascript">
        alert("编辑成功");
        [(${#session.removeAttribute('editok')})]
    </script>
</body>
</html>